A producer/consumer system is a classic problem in which multiple processes work together. The producers generate data and store the data to a queue. The consumers access the queue to consume the data generated by the producers. There may be more than one or more producer and/or consumer. Typical solutions utilize locking to share data between a producer and consumer. The producers and consumers may store and access the data in arbitrary pattern. As a result, the producer does not necessarily store data before the consumer requests access to the data. The consumer determines whether the content of the queue has been inserted by the producer or is old data or null data.
An additional problem occurs when the producers are more active than the readers. The producers may fill the queue faster than the consumers access the data. As a result, the queue may be filled, which blocks additional producers from inserting more data. Until the consumers read data from the queue and create more space, the producers' data may be lost or the producer may be stalled.